{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<!-- （勿改动，执行即可）执行更改背景 -->\n",
       "<link rel=\"stylesheet\" href=\"exam.css\" type=\"text/css\">\n",
       "<h1 style=\"color: red;\">注意单元格的第一行不能改动，否则会影响自动打分</h1>\n"
      ],
      "text/plain": [
       "<IPython.core.display.HTML object>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "\n",
    "%%html\n",
    "<!-- （勿改动，执行即可）执行更改背景 -->\n",
    "<link rel=\"stylesheet\" href=\"exam.css\" type=\"text/css\">\n",
    "<h1 style=\"color: red;\">注意单元格的第一行不能改动，否则会影响自动打分</h1>"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Requirement already satisfied: pandas in c:\\users\\pc\\anaconda3\\lib\\site-packages (1.2.4)\n",
      "Requirement already satisfied: numpy>=1.16.5 in c:\\users\\pc\\anaconda3\\lib\\site-packages (from pandas) (1.20.1)\n",
      "Requirement already satisfied: python-dateutil>=2.7.3 in c:\\users\\pc\\anaconda3\\lib\\site-packages (from pandas) (2.8.1)\n",
      "Requirement already satisfied: pytz>=2017.3 in c:\\users\\pc\\anaconda3\\lib\\site-packages (from pandas) (2021.1)\n",
      "Requirement already satisfied: six>=1.5 in c:\\users\\pc\\anaconda3\\lib\\site-packages (from python-dateutil>=2.7.3->pandas) (1.15.0)\n"
     ]
    }
   ],
   "source": [
    "!pip install pandas"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/markdown": [
       "# Python 期中考（A卷）：目前工作目录C:\\Users\\pc\n",
       "* 共6题，每题20分，80分及格，最高分120，作题时间90分钟。\n",
       "*  答题格首行如 ***# 003*** 勿删除或改动 \n",
       "* 可先挑难度较易的题先做，🌶个数愈高愈难\n",
       "* 执行一格格，最后一格可回报分数（仅供参考）\n",
       " ##提交此.ipynb档，必检查： \n",
       "   * 档名✍A_学号✍（只能用半角数字9码）\n",
       "   *  下格 输入学号（半角数字9码） \n",
       "\n",
       "\n",
       "# 🛂输入学号🛂"
      ],
      "text/plain": [
       "<IPython.core.display.Markdown object>"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 始001（勿改动，执行即可）\n",
    "e = %env\n",
    "_which_= \"A\"  # 卷号\n",
    "import PandasCourse as PC\n",
    "from IPython.display import Markdown\n",
    "Markdown(PC.msgs['opening'].format(w=_which_, d=e['HOMEDRIVE']+ e['HOMEPATH']))    "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "* 本试题参考数据信息：    \n",
    "> 1. df_C1:  作者地址(Author Address)         \n",
    "> 2. text:  所有作者地址 **文本数据**     \n",
    "> 3. info: 所有作者地址 **列表数据**\n",
    "> 4. AU: 作者数据信息 **列表数据**\n",
    "\n",
    "* **勿改动部分如稍有不慎改动，请重新下载该文件，浪费时间后果自负**\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 0-1 数据准备\n",
    "# （勿改动，执行即可） 请观察text文本后再进行答题\n",
    "import pandas as pd\n",
    "df = pd.read_csv(\"WOS_2021.csv\",index_col=[0])\n",
    "df_C1 = df[['PY','C1']]\n",
    "text = '; '.join(df_C1.fillna(\"0\")['C1'].tolist())"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 59,
   "metadata": {},
   "outputs": [],
   "source": [
    "# text"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Q1（20分） 🌶 易\n",
    "* 查找<font style=\"color:red\">\"China\"</font>的次数\n",
    "\n",
    "--------------"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入你想查询的短语：China\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "140"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# A-1 查找\"China\"的次数\n",
    "phrase = input(\"请输入你想查询的短语：\")\n",
    "freq_table_phrase =  text.count(phrase)\n",
    "freq_table_phrase"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Q2 （20分） 🌶 易\n",
    "\n",
    "------------\n",
    "* 用英文 <font style=\"color:red\">\"; \\[ \"</font> 拆分,生成list_split列表，每一个句子将成为列表中独立的元素\n",
    "* 答案示例：\n",
    "```\n",
    "['[Han, Xueying; Stocking, Galen; Gebbie, Matthew A.; Appelbaum, Richard P.] Univ Calif Santa Barbara, Ctr Nanotechnol Soc, Santa Barbara, CA 93106 USA',\n",
    " 'Stocking, Galen] Univ Calif Santa Barbara, Dept Polit Sci, Santa Barbara, CA 93106 USA',\n",
    " 'Gebbie, Matthew A.] Univ Calif Santa Barbara, Dept Mat, Santa Barbara, CA 93106 USA',\n",
    " 'Appelbaum, Richard P.] Univ Calif Santa Barbara, Global & Int Studies, Santa Barbara, CA 93106 USA',\n",
    " 'De Castell, Suzanne] Univ Ontario, Inst Technol, Fac Educ, 11 Simcoe St N, Oshawa, ON L1H 7L7, Canada',\n",
    " 'Larios, Hector] Simon Fraser Univ, Sch Interact Arts Technol, Surrey, BC V3T 0A3, Canada',\n",
    " ...省略]\n",
    "```\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {},
   "outputs": [],
   "source": [
    "# B-1 用英文 \"; [\" 拆分,生成list_split列表，每一个句子将成为列表中独立的元素\n",
    "list_split = text.split('; [')\n",
    "#list_split"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Q3 20分 易\n",
    "\n",
    "-------------\n",
    "* 筛选作者所有地址列表info中出现China的内容，组成新的列表(20分)\n",
    "* 答案示例：\n",
    "```\n",
    "USA_list: \n",
    "['[Freeman, Scott; Eddy, Sarah L.; McDonough, Miles; Okoroafor, Nnadozie; Jordt, Hannah; Wenderoth, Mary Pat] Univ Washington, Dept Biol, Seattle, WA 98195 USA; [Smith, Michelle K.] Univ Maine, Sch Biol & Ecol, Orono, ME 04469 USA',\n",
    " '[Henderson, Charles] Western Michigan Univ, Dept Phys, Kalamazoo, MI 49008 USA; [Henderson, Charles] Western Michigan Univ, Mallinson Inst Sci Educ, Kalamazoo, MI 49008 USA; [Finkelstein, Noah] Univ Colorado, Dept Phys, Boulder, CO 80309 USA',...\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {},
   "outputs": [],
   "source": [
    "# C-1 info: 所有作者列表\n",
    "info = df['C1'].fillna(\"空缺值\").tolist()\n",
    "#info"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {},
   "outputs": [],
   "source": [
    "# C-2 请使用info列表\n",
    "China_list = []\n",
    "for i in info: # 1. 遍历列表\n",
    "    if 'China' in i: # 2. 条件判断，in方法\n",
    "        China_list.append(i) # 3. 列表的新增\n",
    "#请在此作答\n",
    "#China_list"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#  Q4 （20分）🌶🌶 中等\n",
    "\n",
    "-----------------\n",
    "* 尝试用python代码取出 邮政编码（注：5位的数字信息）并存进邮编列表中。\n",
    "* 答案示例：\n",
    "```\n",
    "['93106',\n",
    " '93106',\n",
    " '93106',\n",
    " '93106',\n",
    " '20548',\n",
    " '94305',\n",
    " ...\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {},
   "outputs": [],
   "source": [
    "#info"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [],
   "source": [
    "# D-1 新建邮编_list空列表，后续得到邮编信息请增加进此列表\n",
    "邮编_list = []"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['93106', '93106', '93106', '93106', '20548', '94305', '20230', '95616', '43210', '99164', '47907', '60208', '58202', '47907', '85287', '77843', '53706', '22903', '49221', '40292', '40292', '24061', '14850', '14850', '14850', '14850', '84322', '80309', '48106', '95616', '94949', '10021', '10021', '77843', '84322', '83725', '06269', '02139', '77843', '47907', '24061', '24061', '77057', '10027', '13902', '13902', '70813', '53706', '10003', '20910', '20910', '20910', '20910', '74106', '33458', '33410', '82073', '22036', '45220', '10027', '10027', '75275', '53715', '80523', '60208', '23529', '23284', '22904', '27411', '27110', '27110', '27110', '30144', '30144', '40509', '30144', '20036', '15205', '24061', '24061', '24061', '24061', '74078', '91711', '02215', '02115', '11550', '02115', '02114', '02114', '02115', '52242', '49008', '77843', '68506', '68333', '70803', '70803', '98052', '98195', '61790', '80217', '85721', '16563', '61820', '61820', '02912', '02912', '93106', '37996', '37996', '37996', '59717', '77251', '62901', '86011', '98195', '04469', '23529', '23529', '38152', '36688', '36688', '39529', '02460', '27411', '27110', '27707', '27695', '93106', '19122', '15261', '47907', '24061', '24061', '24061', '49008', '49008', '70433', '27411', '27110', '90840', '98195', '98195', '97201', '95051', '97006', '97201', '97201', '02139', '02115', '68516', '68588', '68182', '80523', '80523', '77843', '76019', '94305', '02912', '35899', '15261', '77843', '80208', '12222', '80523', '80523', '80523', '48202', '44242', '15260', '94129', '94158', '94158', '02155', '60208', '19122', '32310', '95060', '47907', '04469', '58108', '92120', '21250', '16802', '01002', '53706', '94607', '91711', '48825', '48825', '48825', '48825', '48825', '48825', '24061', '17837', '49008', '49008', '77843', '48859', '73019', '20057', '22203', '20057', '20057', '89154', '45221', '45221', '47906', '92110', '06355', '02139', '77005', '10996', '83725', '83725', '02467', '02467', '50011', '60637', '87701', '87701', '80523', '60208', '93106', '15213', '02139', '44242', '29634', '29634', '30602', '30332', '57401', '48824', '30602', '82071', '30602', '03824', '48109', '47907', '85257', '74074', '22230', '20742', '63130', '63130', '19085', '23187', '46556', '47907', '60208', '60208', '49008', '49008', '80309', '44115', '44122', '15213', '15213', '93407', '15213', '92521', '59717', '97403', '47907', '47907', '47907', '20510', '73019', '94305', '94305', '26506', '99210', '95211', '85721', '22230', '78712', '78712', '35899', '15261', '15261', '43201', '43201', '37996', '30318', '23529', '20001', '55057', '65211', '84602', '89557', '14853', '64110', '49931', '49931', '49931', '49931', '20036', '15261', '10016', '30332', '30332', '30332', '30332', '85008', '16802', '59717', '79968', '79968', '79968', '79968', '79968', '79968', '79968', '79968', '38677', '38677', '38677', '30322', '19041', '19041', '80309', '47907', '13045', '32306', '65211', '95053', '93106', '84602', '92093', '50011', '40506', '32816', '90840', '43403', '92182', '30602', '94720', '50311', '61801', '33155', '33155', '60614', '46556', '85287', '75205', '33199', '20059', '77004', '48824', '74104', '80202', '08648', '90095', '11794', '11794', '48859', '48859', '77004', '37614', '11210', '47907', '47907', '27858', '32304', '30118', '65211', '86011', '10017', '42101', '60680', '12561', '52242', '79409', '01742', '94608', '80523', '11235', '12866', '20742', '19122', '60208', '23529', '68198', '68198', '78712', '32611', '79968', '19104', '93740', '48824', '32306', '04469', '04469', '15260', '02138', '02138', '19104', '19104', '44106', '95817', '44106', '79968', '47907', '30602', '47907', '84602', '02155', '30332', '29634', '29625', '29634', '27695', '75275', '37996', '94305', '94305', '08541', '94720', '49008', '33620', '24061', '80309', '48824', '48109', '48109', '92096', '49008', '92120', '20742', '27514', '80309', '38505', '92093', '92093', '92093', '92093', '92093', '77843', '01610', '01610', '01610', '01610', '33199', '21218', '17325', '89512', '17603', '55104', '95616', '95616', '95616', '68588', '32514', '11549', '11530', '11530', '11364', '11439', '11201', '11201', '11201', '10003', '10016', '10016', '32901', '32901', '94403', '94025', '14456', '14260', '78666', '79968', '78666', '77843', '76402', '75428', '22903', '53706', '53706', '02115', '80523', '14642', '02111', '55455', '48197', '92093', '06269', '21218', '92407', '47306', '47907', '27695', '80309', '13244', '79407', '30602', '30602', '85281', '85287', '90265', '11364', '10522', '77901', '47907', '77843', '77843', '68583', '68583', '85721', '85721', '52242', '32611', '01742', '01760', '60660', '60208', '20742', '02467', '84102', '53201', '47907', '29631', '91106', '35294', '60607', '60607', '60607', '60611', '60625', '90095', '30602', '98119', '91406', '85721', '13244', '90840', '74078', '32611', '47907', '47306', '47306', '47306', '55455', '33199', '60208', '90024', '30602', '32306', '10003', '10027', '33199', '33199', '33199', '33199', '33199', '32307', '32307', '32307', '32307', '31419', '28223', '68583', '27599', '76019', '20016', '70118', '32310', '32306', '16801', '55455', '33620', '83725', '33620', '83725', '83725', '33620', '83725', '68588', '33620', '22904', '98105', '48824', '30303', '92182', '61820', '61801', '84112', '61820', '61801', '06515', '53706', '35756', '97331', '97331', '97331', '97331', '27713', '11200', '33199', '11200', '33199', '97331', '48824', '49931', '33606', '75205', '33199', '43210', '43210', '44115', '55455', '19610', '92093', '30460', '01742', '32611', '68583', '32306', '22807', '22807', '47907', '47907', '10021', '07043', '92866', '97207', '48109', '48109', '48824', '77058', '35899', '35899', '35899', '55455', '80306', '76203', '43403', '43403', '48824', '66506', '48824', '48824', '33199', '33199', '98225', '48824', '48824', '49401', '48824', '48824', '53706', '48824', '72703', '72703', '02139', '98225', '32306', '30602', '33124', '70803', '70803', '70803', '68588', '43210', '21205', '06511', '06511', '19038', '48109', '48824', '12181', '48109', '22030', '22030', '14853', '14853', '92617', '19122', '90840', '19716', '37130', '37130', '03435', '10031', '38677', '39216', '72205', '89557', '97331', '93407', '30602', '99164', '33199', '80309', '15231', '29631', '53190', '01606', '47907', '47907', '47906', '27515', '70803', '70803', '70803', '19104', '90095', '90095', '45056', '33199', '85069', '85287', '83725', '83725', '75275', '55108', '27599', '89154', '89154', '97331', '77843', '70310', '43210', '92521', '78712', '78712', '22314', '94305', '53706', '97403', '23173', '10021', '48202', '16801', '94720', '94305', '04469', '02881', '02881', '02881', '60068', '20064', '32114', '47306', '77843', '70310', '43210', '02155', '02481', '24060', '68588', '80523', '22030', '20191', '20191', '93740', '03101', '03101', '53511', '63130', '92521', '77843', '77843', '77843', '29634', '98225', '98119', '83725', '15213', '15213', '20686', '20686', '20686', '68588', '63108', '01106', '95616', '47306', '30602', '32816', '82071', '82071', '20005', '33124', '84322', '21853', '24060', '48824', '60563', '55455', '55455', '55455', '78207', '77843', '22030', '22030', '22030', '22030', '22030', '22903', '22311', '30602', '85212', '38152', '22217', '50011', '30602', '80639', '22030', '22030', '22030', '22030', '22030', '68588', '92110', '80309', '80523', '92182', '80523', '80309', '13850', '91711', '92110', '01003', '01003', '76203', '76203', '76203', '33199', '50614', '37831', '78712', '47907', '52242', '52242', '52242', '49931', '55108', '67260', '38677', '02140', '38152', '08901', '76203', '77843', '77843', '80309', '92093', '92093', '85287', '85212', '27858', '89154', '99164', '99164', '20742', '77251', '77005', '78712', '78712', '78712', '19041', '55105', '49931', '55108', '85212', '85287', '85212', '47907', '47907', '32963', '47907', '47907', '43210', '47907', '84322', '84322', '27703', '37235', '80309', '98225', '17011', '22807', '43081', '21228', '20059', '20059', '20059', '20059', '20059', '20059', '99362', '99164', '43606', '29424', '14852', '77843', '77204', '77204', '15213', '35294', '70803', '70803', '70803', '70803', '30461', '48824', '48824', '94720', '61820', '17837', '77843', '77843', '60637', '60611', '02167', '02167', '02167', '02167', '02167', '02167', '02167', '48109', '48109', '02167', '85721', '79409', '92697', '92697', '46556', '48202', '80309', '80309', '66045', '66045', '46556', '46556', '15260', '27695', '48109', '48824', '20005', '84322', '60607', '19530', '99164', '37203', '37203', '19530', '99164', '28027', '28223', '49931', '27506', '49931', '90041', '90041', '60607', '93106', '10031', '14456', '21218', '60208', '55057', '53706', '19122', '85281', '27412', '19104', '98122', '02167', '53706', '53590', '23185', '21250', '27506', '48393', '38238', '28741', '29442', '40475', '40475', '33960', '23212', '33620', '16802', '20052', '99775', '99775', '99775', '99775', '99775', '99775', '99775', '80639', '40292', '06520', '06520', '42071', '22030', '61761', '47243', '48824', '48824', '65211', '84602', '84602', '52242', '77843', '49008', '49008', '97339', '77843', '30602', '49008', '49008', '53706', '30602', '30602', '80309', '14623', '20005', '20005', '92182', '20005', '22807', '01003', '23529', '19104', '98122', '53706', '04038', '04038', '30605', '02139', '60090', '30332', '30332', '30332', '32306', '32306', '91711', '92110', '90407', '30314', '30322', '27695', '27695', '84322', '29208', '47907', '20059', '35899', '85287', '19716', '19122', '19122', '02138', '80523', '80523', '66506', '66506', '66506', '66506', '94305', '95064', '30332', '45207', '49104', '55057', '55414', '23187', '27695', '59717', '13323', '60637', '53706', '78712', '08901', '08901', '55108', '49931', '11101', '12525', '82071', '27858', '24061', '50011', '50011', '29634', '29634', '08541', '53715', '53715', '49008', '49008', '52242', '77843', '97331', '83725', '37044', '40292', '55108', '83725', '02155', '02155', '01760', '95616', '53705', '18034', '19122', '19122', '16804', '44555', '29634', '01063', '24061', '47907', '30602', '21218', '53706', '22554', '12222', '02138', '02139', '26506', '94143', '53706', '76204', '78249', '20001', '36849', '07102', '07102', '63121', '27695', '54911', '27695', '27858', '20037', '94025', '22030', '48824', '77843', '77843', '33314', '94305', '99164', '49008', '49008', '53706', '30602', '80309', '14623', '20005', '92182', '20005', '22807', '22230', '28223', '48824', '48824', '21801', '17604', '18104', '02167', '02453', '27707', '04330', '76207', '76207', '13203', '13203', '82071', '78666', '33620', '06269', '50011', '53711', '45219', '45219', '45201', '23284', '23909', '90026', '20006', '21218', '37130', '37130', '30332', '68182', '02138', '30308', '30518', '30332', '30030', '12601', '47803', '46202', '46202', '94025', '02138', '02125', '02139', '02138', '47907', '77843', '38152', '22230', '55057', '55057', '22230', '32789', '18015', '20546', '77058', '60208', '14853', '14853', '18034', '18034', '62901', '53706', '95616', '95616', '16802', '85281', '60611', '92103', '19104', '19104', '19104', '37212', '37203', '37167', '93407', '94703', '94720', '84132', '22030', '48109', '48109', '90095', '90095', '35899', '16802', '30602', '80523', '80523', '94025', '80305', '98195', '37203', '98686', '16802', '16802', '30332', '02138', '45221', '96822', '52242', '30303', '01267', '30332', '17551', '73505', '73019', '30602', '33620', '97331', '60208', '60208', '60208', '60208', '60605', '60208', '01003', '01003', '12180', '52242', '52242', '60208', '48824', '10027', '10027', '27707', '77843', '77843', '77843', '77843', '77843', '19104', '98122', '55105', '77843', '83725', '84322', '32901', '58201', '80309', '94720', '90089', '90089', '19104', '90089', '90089', '21218', '19122', '90045', '90045', '47907', '47933', '60637', '60602', '37235', '37235', '37235', '62901', '31705', '82071', '03755', '82073', '07003', '30602', '30602', '30602', '77843', '30602', '12866', '14260', '47306', '60115', '14260', '14260', '94305', '10065', '10031', '60647', '60208', '60208', '61801', '20742', '10027', '10024', '23529', '32224', '90840', '37235', '77843', '45207', '98195', '46202', '46202', '46202', '85281', '91601', '95826', '95826', '49221', '57007', '53706', '47907', '24061', '27695', '24061', '36849', '30144', '44115', '44115', '23824', '21620', '27858', '47907', '92103', '02452', '48824', '97331', '50011', '49931', '49931', '49931', '06269', '78746', '22904', '02155', '60208', '60208', '60208', '80309', '47907', '77843', '77843', '12211', '20016', '49931', '13902', '48674', '13244', '97331', '18015', '85287', '19104', '97403', '04101', '16802', '76019', '02215', '92103', '92103', '95616', '92697', '32816', '90747', '03431', '90840', '43403', '32816', '50011', '40506', '27412', '23284', '10038', '10520', '28403', '47405', '89154', '02139', '37996', '27695', '98225', '15261', '15261', '15261', '15261', '15261', '80523', '80523', '80523', '80523', '80523', '78712', '78712', '48824', '48824', '48824', '89154', '02139', '24061', '61790', '27695', '27695', '28608', '27695', '32601', '01742', '47907', '47907', '15260', '33199', '97008', '77843', '94720', '08618', '47907', '95616', '02139', '94305', '85287', '98195', '89154', '60637', '60439', '80523', '52803', '80631', '80208', '92182', '48824', '52242', '49008', '22030', '94025', '55792', '47907', '47907', '83814', '83814', '48109', '48824', '48824', '48824', '53706', '32306', '77843', '78207', '77843', '77843', '77843', '78363', '77446', '78412', '79015', '20005', '20001', '16802', '29801', '46556', '46556', '14618', '53706', '47405', '22903', '14222', '58202', '55108', '47907', '28403', '26506', '46391', '45750', '33124', '84322', '47907', '32611', '32611', '32611', '13346', '13244', '84770', '29672', '20005', '48109', '52242', '02138', '68588', '68182', '70803', '70803', '19104', '19104', '19104', '80309', '80309', '80309', '80309', '98225', '93407', '37923', '48824', '10038', '72501', '49931', '63103', '92182', '30602', '10027', '10027', '90095', '90024', '90095', '90095', '90095', '79409', '92110', '01742', '11794', '11794', '80523', '80523', '80523', '98122', '19104', '19104', '46556', '45056', '47405', '46227', '65409', '58108', '06520', '78712', '97203', '97203', '97203', '97203', '97203', '85212', '33199', '60208', '94117', '60607', '60611', '32611', '60625', '03435', '77843', '77843', '77843', '29303', '30605', '74078', '60115', '79409', '29528', '78712', '40292', '68588', '68588', '80523', '77843', '43210', '53511', '53120', '92521', '92506', '47405', '13902', '94720', '08901', '53706', '48824', '37235', '58316', '65211', '02138', '02138', '77843', '77204', '77204', '10027', '85201', '48824', '48824', '75428', '93106', '98195', '93740', '89154', '92697', '02155', '92093', '92093', '33199', '33199', '33199', '02138', '47907', '47907', '47907', '28223', '28223', '28223', '28223', '33124', '30144', '30144', '30144', '21005', '02155', '02155', '01760', '20016', '98036', '55455', '55455', '55108', '50011', '78205', '53706', '83616', '83725', '48859', '23005', '23005', '21402', '33199', '27695', '32816', '32816', '21252', '21252', '30322', '19041', '80309', '97201', '97201', '97201', '16802', '39762', '50011', '16802', '32816', '32816', '32816', '30460', '87106', '90095', '87106', '60202', '33487', '02747', '02747', '33431', '19104', '72701', '92717', '10038', '19122', '20036', '19716', '42101', '32306', '14204', '98686', '60208', '15260', '20560', '19104', '19104', '19104', '14420', '93106', '48895', '15213', '30303', '85287', '20059', '08901', '08901', '08901', '22201', '49504', '76798', '27695', '90089', '98195', '98195', '32816', '33124', '06825', '46383', '60616', '90089', '90095', '90747', '00682', '14456', '10031', '10031', '66762', '83642', '30602', '30602', '30602', '30602', '77251', '27706', '77843', '02139', '77843', '80523', '79409', '68182', '22030', '30308', '40506', '11794', '02155', '02140', '02138', '16802', '23284', '32816', '32816', '29631', '97403', '97403', '97403', '97403', '46556', '83725', '53144', '33620', '98122', '22904', '02138', '02138', '02138', '01003', '62901', '02125', '02125', '89154', '65211', '27515', '05405', '99164', '43210', '12561', '07043', '07043', '02747', '02747', '37804', '14627', '14627', '33620', '92634', '44242', '45220', '49931', '30302', '30332', '30602', '26506', '43403', '50011', '40506', '32816', '90840', '43210', '40513', '40509', '14853', '02747', '02903', '94305', '94305', '94305', '94305', '94305', '94305', '48824', '48824', '97331', '85721', '48824', '48824', '48824', '48824', '48824', '48824', '48824', '95616', '78712', '30332', '20002', '77710', '14623', '06438', '21250', '93106', '02140', '39210', '39210', '70803', '70803', '27411', '27411', '27411', '27411', '34949', '14204', '98686', '80309', '75390', '16802', '45435', '63121', '65211', '63103', '85287', '29634', '29634', '29634', '95616', '97132', '04240', '22230', '66506', '32611', '49008', '33199', '58202', '47408', '47405', '99775', '02139', '02139', '02139', '93106', '93106', '93106', '93106', '20548', '94305', '20230', '95616', '43210', '99164', '47907', '60208', '58202', '47907', '85287', '77843', '53706', '22903', '49221', '40292', '40292', '24061', '14850', '14850', '14850', '14850', '84322', '80309', '48106', '95616', '94949', '10021', '10021', '77843', '84322', '83725', '06269', '02139', '77843', '47907', '24061', '24061', '77057', '10027', '13902', '13902', '70813', '53706', '10003', '20910', '20910', '20910', '20910', '74106', '33458', '33410', '82073', '22036', '45220', '10027', '10027', '75275', '53715', '80523', '60208', '23529', '23284', '22904', '27411', '27110', '27110', '27110', '30144', '30144', '40509', '30144', '20036', '15205', '24061', '24061', '24061', '24061', '74078', '91711', '02215', '02115', '11550', '02115', '02114', '02114', '02115', '52242', '49008', '77843', '68506', '68333', '70803', '70803', '98052', '98195', '61790', '80217', '85721', '16563', '61820', '61820', '02912', '02912', '93106', '37996', '37996', '37996', '59717', '77251', '62901', '86011', '98195', '04469', '23529', '23529', '38152', '36688', '36688', '39529', '02460', '27411', '27110', '27707', '27695', '93106', '19122', '15261', '47907', '24061', '24061', '24061', '49008', '49008', '70433', '27411', '27110', '90840', '98195', '98195', '97201', '95051', '97006', '97201', '97201', '02139', '02115', '68516', '68588', '68182', '80523', '80523', '77843', '76019', '94305', '02912', '35899', '15261', '77843', '80208', '12222', '80523', '80523', '80523', '48202', '44242', '15260', '94129', '94158', '94158', '02155', '60208', '19122', '32310', '95060', '47907', '04469', '58108', '92120', '21250', '16802', '01002', '53706', '94607', '91711', '48825', '48825', '48825', '48825', '48825', '48825', '24061', '17837', '49008', '49008', '77843', '48859', '73019', '20057', '22203', '20057', '20057', '89154', '45221', '45221', '47906', '92110', '06355', '02139', '77005', '10996', '83725', '83725', '02467', '02467', '50011', '60637', '87701', '87701', '80523', '60208', '93106', '15213', '02139', '44242', '29634', '29634', '30602', '30332', '57401', '48824', '30602', '82071', '30602', '03824', '48109', '47907', '85257', '74074', '22230', '20742', '63130', '63130', '19085', '23187', '46556', '47907', '60208', '60208', '49008', '49008', '80309', '44115', '44122', '15213', '15213', '93407', '15213', '92521', '59717', '97403', '47907', '47907', '47907', '20510', '73019', '94305', '94305', '26506', '99210', '95211', '85721', '22230', '78712', '78712', '35899', '15261', '15261', '43201', '43201', '37996', '30318', '23529', '20001', '55057', '65211', '84602', '89557', '14853', '64110', '49931', '49931', '49931', '49931', '20036', '15261', '10016', '30332', '30332', '30332', '30332', '85008', '16802', '59717', '79968', '79968', '79968', '79968', '79968', '79968', '79968', '79968', '38677', '38677', '38677', '30322', '19041', '19041', '80309', '47907', '13045', '32306', '65211', '95053', '93106', '84602', '92093', '50011', '40506', '32816', '90840', '43403', '92182', '30602', '94720', '50311', '61801', '33155', '33155', '60614', '46556', '85287', '75205', '33199', '20059', '77004', '48824', '74104', '80202', '08648', '90095', '11794', '11794', '48859', '48859', '77004', '37614', '11210', '47907', '47907', '27858', '32304', '30118', '65211', '86011', '10017', '42101', '60680', '12561', '52242', '79409', '01742', '94608', '80523', '11235', '12866', '20742', '19122', '60208', '23529', '68198', '68198', '78712', '32611', '79968', '19104', '93740', '48824', '32306', '04469', '04469', '15260', '02138', '02138', '19104', '19104', '44106', '95817', '44106', '79968', '47907', '30602', '47907', '84602', '02155', '30332', '29634', '29625', '29634', '27695', '75275', '37996', '94305', '94305', '08541', '94720', '49008', '33620', '24061', '80309', '48824', '48109', '48109', '92096', '49008', '92120', '20742', '27514', '80309', '38505', '92093', '92093', '92093', '92093', '92093', '77843', '01610', '01610', '01610', '01610', '33199', '21218', '17325', '89512', '17603', '55104', '95616', '95616', '95616', '68588', '32514', '11549', '11530', '11530', '11364', '11439', '11201', '11201', '11201', '10003', '10016', '10016', '32901', '32901', '94403', '94025', '14456', '14260', '78666', '79968', '78666', '77843', '76402', '75428', '22903', '53706', '53706', '02115', '80523', '14642', '02111', '55455', '48197', '92093', '06269', '21218', '92407', '47306', '47907', '27695', '80309', '13244', '79407', '30602', '30602', '85281', '85287', '90265', '11364', '10522', '77901', '47907', '77843', '77843', '68583', '68583', '85721', '85721', '52242', '32611', '01742', '01760', '60660', '60208', '20742', '02467', '84102', '53201', '47907', '29631', '91106', '35294', '60607', '60607', '60607', '60611', '60625', '90095', '30602', '98119', '91406', '85721', '13244', '90840', '74078', '32611', '47907', '47306', '47306', '47306', '55455', '33199', '60208', '90024', '30602', '32306', '10003', '10027', '33199', '33199', '33199', '33199', '33199', '32307', '32307', '32307', '32307', '31419', '28223', '68583', '27599', '76019', '20016', '70118', '32310', '32306', '16801', '55455', '33620', '83725', '33620', '83725', '83725', '33620', '83725', '68588', '33620', '22904', '98105', '48824', '30303', '92182', '61820', '61801', '84112', '61820', '61801', '06515', '53706', '35756', '97331', '97331', '97331', '97331', '27713', '11200', '33199', '11200', '33199', '97331', '48824', '49931', '33606', '75205', '33199', '43210', '43210', '44115', '55455', '19610', '92093', '30460', '01742', '32611', '68583', '32306', '22807', '22807', '47907', '47907', '10021', '07043', '92866', '97207', '48109', '48109', '48824', '77058', '35899', '35899', '35899', '55455', '80306', '76203', '43403', '43403', '48824', '66506', '48824', '48824', '33199', '33199', '98225', '48824', '48824', '49401', '48824', '48824', '53706', '48824', '72703', '72703', '02139', '98225', '32306', '30602', '33124', '70803', '70803', '70803', '68588', '43210', '21205', '06511', '06511', '19038', '48109', '48824', '12181', '48109', '22030', '22030', '14853', '14853', '92617', '19122', '90840', '19716', '37130', '37130', '03435', '10031', '38677', '39216', '72205', '89557', '97331', '93407', '30602', '99164', '33199', '80309', '15231', '29631', '53190', '01606', '47907', '47907', '47906', '27515', '70803', '70803', '70803', '19104', '90095', '90095', '45056', '33199', '85069', '85287', '83725', '83725', '75275', '55108', '27599', '89154', '89154', '97331', '77843', '70310', '43210', '92521', '78712', '78712', '22314', '94305', '53706', '97403', '23173', '10021', '48202', '16801', '94720', '94305', '04469', '02881', '02881', '02881', '60068', '20064', '32114', '47306', '77843', '70310', '43210', '02155', '02481', '24060', '68588', '80523', '22030', '20191', '20191', '93740', '03101', '03101', '53511', '63130', '92521', '77843', '77843', '77843', '29634', '98225', '98119', '83725', '15213', '15213', '20686', '20686', '20686', '68588', '63108', '01106', '95616', '47306', '30602', '32816', '82071', '82071', '20005', '33124', '84322', '21853', '24060', '48824', '60563', '55455', '55455', '55455', '78207', '77843', '22030', '22030', '22030', '22030', '22030', '22903', '22311', '30602', '85212', '38152', '22217', '50011', '30602', '80639', '22030', '22030', '22030', '22030', '22030', '68588', '92110', '80309', '80523', '92182', '80523', '80309', '13850', '91711', '92110', '01003', '01003', '76203', '76203', '76203', '33199', '50614', '37831', '78712', '47907', '52242', '52242', '52242', '49931', '55108', '67260', '38677', '02140', '38152', '08901', '76203', '77843', '77843', '80309', '92093', '92093', '85287', '85212', '27858', '89154', '99164', '99164', '20742', '77251', '77005', '78712', '78712', '78712', '19041', '55105', '49931', '55108', '85212', '85287', '85212', '47907', '47907', '32963', '47907', '47907', '43210', '47907', '84322', '84322', '27703', '37235', '80309', '98225', '17011', '22807', '43081', '21228', '20059', '20059', '20059', '20059', '20059', '20059', '99362', '99164', '43606', '29424', '14852', '77843', '77204', '77204', '15213', '35294', '70803', '70803', '70803', '70803', '30461', '48824', '48824', '94720', '61820', '17837', '77843', '77843', '60637', '60611', '02167', '02167', '02167', '02167', '02167', '02167', '02167', '48109', '48109', '02167', '85721', '79409', '92697', '92697', '46556', '48202', '80309', '80309', '66045', '66045', '46556', '46556', '15260', '27695', '48109', '48824', '20005', '84322', '60607', '19530', '99164', '37203', '37203', '19530', '99164', '28027', '28223', '49931', '27506', '49931', '90041', '90041', '60607', '93106', '10031', '14456', '21218', '60208', '55057', '53706', '19122', '85281', '27412', '19104', '98122', '02167', '53706', '53590', '23185', '21250', '27506', '48393', '38238', '28741', '29442', '40475', '40475', '33960', '23212', '33620', '16802', '20052', '99775', '99775', '99775', '99775', '99775', '99775', '99775', '80639', '40292', '06520', '06520', '42071', '22030', '61761', '47243', '48824', '48824', '65211', '84602', '84602', '52242', '77843', '49008', '49008', '97339', '77843', '30602', '49008', '49008', '53706', '30602', '30602', '80309', '14623', '20005', '20005', '92182', '20005', '22807', '01003', '23529', '19104', '98122', '53706', '04038', '04038', '30605', '02139', '60090', '30332', '30332', '30332', '32306', '32306', '91711', '92110', '90407', '30314', '30322', '27695', '27695', '84322', '29208', '47907', '20059', '35899', '85287', '19716', '19122', '19122', '02138', '80523', '80523', '66506', '66506', '66506', '66506', '94305', '95064', '30332', '45207', '49104', '55057', '55414', '23187', '27695', '59717', '13323', '60637', '53706', '78712', '08901', '08901', '55108', '49931', '11101', '12525', '82071', '27858', '24061', '50011', '50011', '29634', '29634', '08541', '53715', '53715', '49008', '49008', '52242', '77843', '97331', '83725', '37044', '40292', '55108', '83725', '02155', '02155', '01760', '95616', '53705', '18034', '19122', '19122', '16804', '44555', '29634', '01063', '24061', '47907', '30602', '21218', '53706', '22554', '12222', '02138', '02139', '26506', '94143', '53706', '76204', '78249', '20001', '36849', '07102', '07102', '63121', '27695', '54911', '27695', '27858', '20037', '94025', '22030', '48824', '77843', '77843', '33314', '94305', '99164', '49008', '49008', '53706', '30602', '80309', '14623', '20005', '92182', '20005', '22807', '22230', '28223', '48824', '48824', '21801', '17604', '18104', '02167', '02453', '27707', '04330', '76207', '76207', '13203', '13203', '82071', '78666', '33620', '06269', '50011', '53711', '45219', '45219', '45201', '23284', '23909', '90026', '20006', '21218', '37130', '37130', '30332', '68182', '02138', '30308', '30518', '30332', '30030', '12601', '47803', '46202', '46202', '94025', '02138', '02125', '02139', '02138', '47907', '77843', '38152', '22230', '55057', '55057', '22230', '32789', '18015', '20546', '77058', '60208', '14853', '14853', '18034', '18034', '62901', '53706', '95616', '95616', '16802', '85281', '60611', '92103', '19104', '19104', '19104', '37212', '37203', '37167', '93407', '94703', '94720', '84132', '22030', '48109', '48109', '90095', '90095', '35899', '16802', '30602', '80523', '80523', '94025', '80305', '98195', '37203', '98686', '16802', '16802', '30332', '02138', '45221', '96822', '52242', '30303', '01267', '30332', '17551', '73505', '73019', '30602', '33620', '97331', '60208', '60208', '60208', '60208', '60605', '60208', '01003', '01003', '12180', '52242', '52242', '60208', '48824', '10027', '10027', '27707', '77843', '77843', '77843', '77843', '77843', '19104', '98122', '55105', '77843', '83725', '84322', '32901', '58201', '80309', '94720', '90089', '90089', '19104', '90089', '90089', '21218', '19122', '90045', '90045', '47907', '47933', '60637', '60602', '37235', '37235', '37235', '62901', '31705', '82071', '03755', '82073', '07003', '30602', '30602', '30602', '77843', '30602', '12866', '14260', '47306', '60115', '14260', '14260', '94305', '10065', '10031', '60647', '60208', '60208', '61801', '20742', '10027', '10024', '23529', '32224', '90840', '37235', '77843', '45207', '98195', '46202', '46202', '46202', '85281', '91601', '95826', '95826', '49221', '57007', '53706', '47907', '24061', '27695', '24061', '36849', '30144', '44115', '44115', '23824', '21620', '27858', '47907', '92103', '02452', '48824', '97331', '50011', '49931', '49931', '49931', '06269', '78746', '22904', '02155', '60208', '60208', '60208', '80309', '47907', '77843', '77843', '12211', '20016', '49931', '13902', '48674', '13244', '97331', '18015', '85287', '19104', '97403', '04101', '16802', '76019', '02215', '92103', '92103', '95616', '92697', '32816', '90747', '03431', '90840', '43403', '32816', '50011', '40506', '27412', '23284', '10038', '10520', '28403', '47405', '89154', '02139', '37996', '27695', '98225', '15261', '15261', '15261', '15261', '15261', '80523', '80523', '80523', '80523', '80523', '78712', '78712', '48824', '48824', '48824', '89154', '02139', '24061', '61790', '27695', '27695', '28608', '27695', '32601', '01742', '47907', '47907', '15260', '33199', '97008', '77843', '94720', '08618', '47907', '95616', '02139', '94305', '85287', '98195', '89154', '60637', '60439', '80523', '52803', '80631', '80208', '92182', '48824', '52242', '49008', '22030', '94025', '55792', '47907', '47907', '83814', '83814', '48109', '48824', '48824', '48824', '53706', '32306', '77843', '78207', '77843', '77843', '77843', '78363', '77446', '78412', '79015', '20005', '20001', '16802', '29801', '46556', '46556', '14618', '53706', '47405', '22903', '14222', '58202', '55108', '47907', '28403', '26506', '46391', '45750', '33124', '84322', '47907', '32611', '32611', '32611', '13346', '13244', '84770', '29672', '20005', '48109', '52242', '02138', '68588', '68182', '70803', '70803', '19104', '19104', '19104', '80309', '80309', '80309', '80309', '98225', '93407', '37923', '48824', '10038', '72501', '49931', '63103', '92182', '30602', '10027', '10027', '90095', '90024', '90095', '90095', '90095', '79409', '92110', '01742', '11794', '11794', '80523', '80523', '80523', '98122', '19104', '19104', '46556', '45056', '47405', '46227', '65409', '58108', '06520', '78712', '97203', '97203', '97203', '97203', '97203', '85212', '33199', '60208', '94117', '60607', '60611', '32611', '60625', '03435', '77843', '77843', '77843', '29303', '30605', '74078', '60115', '79409', '29528', '78712', '40292', '68588', '68588', '80523', '77843', '43210', '53511', '53120', '92521', '92506', '47405', '13902', '94720', '08901', '53706', '48824', '37235', '58316', '65211', '02138', '02138', '77843', '77204', '77204', '10027', '85201', '48824', '48824', '75428', '93106', '98195', '93740', '89154', '92697', '02155', '92093', '92093', '33199', '33199', '33199', '02138', '47907', '47907', '47907', '28223', '28223', '28223', '28223', '33124', '30144', '30144', '30144', '21005', '02155', '02155', '01760', '20016', '98036', '55455', '55455', '55108', '50011', '78205', '53706', '83616', '83725', '48859', '23005', '23005', '21402', '33199', '27695', '32816', '32816', '21252', '21252', '30322', '19041', '80309', '97201', '97201', '97201', '16802', '39762', '50011', '16802', '32816', '32816', '32816', '30460', '87106', '90095', '87106', '60202', '33487', '02747', '02747', '33431', '19104', '72701', '92717', '10038', '19122', '20036', '19716', '42101', '32306', '14204', '98686', '60208', '15260', '20560', '19104', '19104', '19104', '14420', '93106', '48895', '15213', '30303', '85287', '20059', '08901', '08901', '08901', '22201', '49504', '76798', '27695', '90089', '98195', '98195', '32816', '33124', '06825', '46383', '60616', '90089', '90095', '90747', '00682', '14456', '10031', '10031', '66762', '83642', '30602', '30602', '30602', '30602', '77251', '27706', '77843', '02139', '77843', '80523', '79409', '68182', '22030', '30308', '40506', '11794', '02155', '02140', '02138', '16802', '23284', '32816', '32816', '29631', '97403', '97403', '97403', '97403', '46556', '83725', '53144', '33620', '98122', '22904', '02138', '02138', '02138', '01003', '62901', '02125', '02125', '89154', '65211', '27515', '05405', '99164', '43210', '12561', '07043', '07043', '02747', '02747', '37804', '14627', '14627', '33620', '92634', '44242', '45220', '49931', '30302', '30332', '30602', '26506', '43403', '50011', '40506', '32816', '90840', '43210', '40513', '40509', '14853', '02747', '02903', '94305', '94305', '94305', '94305', '94305', '94305', '48824', '48824', '97331', '85721', '48824', '48824', '48824', '48824', '48824', '48824', '48824', '95616', '78712', '30332', '20002', '77710', '14623', '06438', '21250', '93106', '02140', '39210', '39210', '70803', '70803', '27411', '27411', '27411', '27411', '34949', '14204', '98686', '80309', '75390', '16802', '45435', '63121', '65211', '63103', '85287', '29634', '29634', '29634', '95616', '97132', '04240', '22230', '66506', '32611', '49008', '33199', '58202', '47408', '47405', '99775', '02139', '02139', '02139']\n"
     ]
    }
   ],
   "source": [
    "for i in info:\n",
    "    for j in i.split(' '):\n",
    "        if len(j) == 5 and j.isdigit(): # 1. 字段的长度是5；2. 字段里面的内容是数值\n",
    "            邮编_list.append(j)\n",
    "print(邮编_list)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Q5 20分 🌶🌶🌶 难\n",
    "\n",
    "----------------\n",
    "* 尝试将年份列表中的值转换成整数,并统计每一年出现的次数和空缺值出现的次数，并以字典的形式展现。\n",
    "* 答案示例：\n",
    "```\n",
    "{'空缺值': 116,\n",
    " 2015: 111,\n",
    " 2014: 58,\n",
    " 2013: 42,\n",
    "...\n",
    " ```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {},
   "outputs": [],
   "source": [
    "# E-1 数据准备（所有年份数据列表） 学生直接执行\n",
    "PY_list = df_C1['PY'].fillna(\"空缺值\").to_list()\n",
    "#PY_list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "[2015.0, 2014.0, 2013.0, 2012.0, 2011.0, 2010.0, 2009.0, 2008.0, 2007.0, 2006.0, 2005.0, 2004.0, 2021.0, '空缺值', 2020.0, 2018.0, 2017.0, 2016.0, 2019.0]\n"
     ]
    }
   ],
   "source": [
    "年份唯一值 = []\n",
    "for i in PY_list:\n",
    "    if i not in 年份唯一值:\n",
    "        年份唯一值.append(i)\n",
    "print(年份唯一值)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "{'空缺值': 116, 2004: 2, 2005: 1, 2006: 2, 2007: 5, 2008: 4, 2009: 10, 2010: 10, 2011: 17, 2012: 21, 2013: 42, 2014: 58, 2015: 111, 2016: 138, 2017: 176, 2018: 221, 2019: 280, 2020: 330, 2021: 174}\n"
     ]
    }
   ],
   "source": [
    "PY_count = {}\n",
    "for i in set(PY_list): # set（集合）解决上述列表中的唯一值最好的方案\n",
    "    if i == '空缺值':\n",
    "        PY_count[i]= PY_list.count(i) # 字典的创建\n",
    "    else:\n",
    "        PY_count[int(i)]= PY_list.count(i)\n",
    "print(PY_count)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "111"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "PY_list.count(2015.0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# E-2 尝试将年份列表中的值转换成整数,并统计每一年出现的次数和空缺值出现的次数，最终以字典的形式展现，示例代码参考上述markdown\n",
    "#请在此作答\n",
    "PY_count"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Q6 20分 🌶🌶🌶 难 \n",
    "\n",
    "--------------\n",
    "* 按照列表下表索引建立字典，在字典中拆分作者，并统计每篇文章作者的人数\n",
    "> 1. 请以每篇文章的index作为字典的key；\n",
    "> 2. value中仍为字典，字典的key分别有：\n",
    ">> 1. \"author_list\"：存储作者列表\n",
    ">> 2. \"author_num\":统计作者个数\n",
    ">> 3. 结果示例如下:\n",
    "```\n",
    "{0: {'author_list': ['Han, XY',\n",
    "   ' Stocking, G',\n",
    "   ' Gebbie, MA',\n",
    "   ' Appelbaum, RP'],\n",
    "  'author_num': 4},\n",
    " 1: {'author_list': ['De Castell, S',\n",
    "   ' Larios, H',\n",
    "   ' Jenson, J',\n",
    "   ' Smith, DH'],\n",
    "  'author_num': 4},\n",
    " 2: {'author_list': ['Putansu, SR'], 'author_num': 1},\n",
    " 3: {'author_list': ['Cira, NJ',\n",
    "   ' Chung, AM',\n",
    "   ' Denisin, AK',\n",
    "   ' Rensi, S',\n",
    "   ' Sanchez, GN',\n",
    "   ' Quake, SR',\n",
    "   ' Riedel-Kruse, IH'],\n",
    "  'author_num': 7},\n",
    "...后面省略\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {},
   "outputs": [],
   "source": [
    "# F-1 （勿改动，执行即可） 请先观察AU_list后再做题\n",
    "AU_list = df.AU.to_list()\n",
    "#print(AU_list)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {},
   "outputs": [],
   "source": [
    "author_dict = {}\n",
    "for i,v in enumerate(AU_list):\n",
    "    if type(v) != float:\n",
    "#         print(i,v.split(';'),len(v.split(';')))\n",
    "        author_dict[i] = {\n",
    "            'author_list':v.split(';'),\n",
    "            'author_num':len(v.split(';'))\n",
    "        }\n",
    "#print(author_dict)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# F-2 \n",
    "AU_dict = {}\n",
    "# 请在此作答，可新建AU_list,也可其他方法\n",
    "\n",
    "AU_dict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "author_dict = {}\n",
    "# 请在此作答\n",
    "\n",
    "author_dict"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "#  终 （勿改动，执行即可）回报答题分数"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 58,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{'你本次考试总分': 100,\n",
       " 'details': {'freq_table_phrase': 20,\n",
       "  'list_split': 20,\n",
       "  'China_list': 20,\n",
       "  '邮编_list': 20,\n",
       "  'PY_count': 20}}"
      ]
     },
     "execution_count": 58,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#终001 （勿改动，执行即可）回报答题分数\n",
    "import PandasCourse as PC\n",
    "\n",
    "score_details = PC.score_answers(locals(), _which_)\n",
    "score_details"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "339.111px"
   },
   "toc_section_display": true,
   "toc_window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
